package com.zeei.ems.base.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.github.pagehelper.PageInfo;
import com.zeei.ems.base.dao.StationPointDao;
import com.zeei.ems.base.page.PageParamVO;
import com.zeei.ems.base.service.StationPointService;
import com.zeei.ems.base.util.PageUtil;
import com.zeei.ems.base.util.StringUtil;
import com.zeei.ems.base.vo.QueryStationPointParam;
import com.zeei.ems.base.vo.StationPointVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 练威
 * @version 创建时间：2016年8月4日 类说明
 */
@Service("stationPointService")
public class StationPointServiceImpl implements StationPointService {

	@Autowired
	private StationPointDao stationPointDao;

	@Override
	public PageInfo<StationPointVO> queryStationPoint(QueryStationPointParam param, PageParamVO pageParam,
													  Integer scode) {
		Map<String, Object> condition = new HashMap<>();
		// 存放有实时告警的站点列表
		List<String> status = new ArrayList<>();
		// 存放有超标告警的站点列表
		List<String> overproofList = new ArrayList<>();
		List<String> regionCodeList = StringUtil.splitToList(param.getRegionCode());

		condition.put("pointCodes", param.getPointCodes());
		condition.put("systemType", param.getSystemType());
		condition.put("searchPointName", param.getSearchPointName());
		condition.put("controlLevel", param.getControlLevel());
		condition.put("regionCodeList", regionCodeList);
		condition.put("areaCodeList", param.getAreaCodeList());
		condition.put("pscode", param.getPscode());
		condition.put("pointCode", param.getPointCode());
		condition.put("scode", scode);

		// 判断是否分页
		if (param.getIsPage() == null || param.getIsPage() > 0) {

			// PageHelper.startPage(pageParam.getPage(), pageParam.getRows());
			PageUtil.setPage(pageParam);
		}

		List<StationPointVO> list = stationPointDao.queryStationPointByCondition(condition);


		return new PageInfo<StationPointVO>(list);
	}

	@Override
	public List<StationPointVO> queryStationPointBySystemType(String systemType) {
		Map<String, Object> condition = new HashMap<>();
		condition.put("systemType", systemType);
		List<StationPointVO> list = stationPointDao.queryStationPointByCondition(condition);
		return list;
	}

	
}
